//
//  SetingViewController.m
//  MemberProject
//
//  Created by macbook on 15/4/14.
//  Copyright (c) 2015年 MAC OS X. All rights reserved.
//

#import "SetingViewController.h"
#import "EditInfoViewController.h"
#import "VersionViewController.h"
#import "AboutUsViewController.h"
#import "EditPasswordViewController.h"
@interface SetingViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(strong,nonatomic)UITableView *tableView;
@property(strong,nonatomic)NSArray *data;
@end

@implementation SetingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.automaticallyAdjustsScrollViewInsets=NO;
    self.title=@"设置";
    UITableView *tableView=[[UITableView alloc]initWithFrame:CGRectMake(5, 64+5, SCREEN_WIDTH-10, SCREEN_HEIGHT/13*4) style:UITableViewStylePlain];
    self.tableView=tableView;
    tableView.scrollEnabled=NO;
    tableView.delegate=self;
    tableView.dataSource=self;
    tableView.layer.cornerRadius=5.0f;
    tableView.layer.borderWidth=0.5;
    tableView.layer.borderColor=[UIColor colorWithRed:231/255.0 green:231/255.0 blue:231/255.0 alpha:1].CGColor;
    [self.view addSubview:tableView];
    self.data=@[@"修改信息",@"修改密码",@"当前版本",@"关于我们"];
    [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"CellIdentifier"];

}
#pragma mark - tableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.data.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifier=@"CellIdentifier";
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.text=self.data[indexPath.row];
    cell.textLabel.textAlignment=NSTextAlignmentCenter;
    cell.textLabel.font=[UIFont systemFontOfSize:18.0f];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return SCREEN_HEIGHT/13;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    switch (indexPath.row) {
        case 0:{
            //修改信息
//            EditInfoViewController *vc=[[EditInfoViewController alloc]init];
//            [self.navigationController pushViewController:vc animated:YES];
                    }
            break;
        case 1:{
            EditPasswordViewController *vc=[[EditPasswordViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 2:{
            //当前版本
            VersionViewController *vc=[[VersionViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        
        }
            break;
        case 3:{
            AboutUsViewController *vc=[[AboutUsViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        
        }
            break;
    }
    
}
@end
